home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 May: Tool Chest / Developer CD Series Tool Chest (Apple Computer)(May 1999).iso / Tool Chest / Development Kits / MPW etc / MPW-GM / MPW / Examples / CFMExamples / ModApp / cfrg.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-12-03  |  1.8 KB  |  97 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        cfrg.h
  3.  
  4.     Contains:    Data structures which define the 'cfrg' resource format
  5.                 and a simplified version for ModApp's use.
  6.  
  7.     Written by:    Richard Clark
  8.  
  9.     Copyright:    © 1994 by Apple Computer, Inc., all rights reserved.
  10.  
  11.     Change History (most recent first):
  12.  
  13.                  1/13/94    RC        Created
  14.  
  15.     To Do:
  16. */
  17.  
  18. #ifndef __CFRG__
  19. #define __CFRG__
  20.  
  21. #ifndef __TYPES__
  22.     #include <Types.h>
  23. #endif
  24.  
  25.  
  26. // The format of the 'cfrg' on disk. This is defined in <CodeFragmentTypes.r>
  27. #ifdef powerc
  28.     #pragma options align=mac68k
  29. #endif
  30.  
  31. struct cfrgHeader {
  32.     long     res1;
  33.     long     res2;
  34.     long     version;
  35.     long     res3;
  36.     long     res4;
  37.     long     filler1;
  38.     long     filler2;
  39.     long     itemCount;
  40.     char    arrayStart;    // Array of externalItems begins here
  41. };
  42. typedef struct cfrgHeader cfrgHeader, *hdrPtr, **hdrHand;
  43.  
  44. struct cfrgItem {
  45.     OSType     archType;
  46.     long     updateLevel;
  47.     long    currVersion;
  48.     long    oldDefVersion;
  49.     long    appStackSize;
  50.     short    appSubFolder;
  51.     char    usage;
  52.     char    location;
  53.     long    codeOffset;
  54.     long    codeLength;
  55.     long    res1;
  56.     long    res2;
  57.     short    itemSize; // %4 == 0
  58.     Str255    name;
  59.     // Only make the final p-string as long as needed, then align to
  60.     // a longword boundary
  61. };
  62. typedef struct cfrgItem cfrgItem;
  63. #ifdef powerc
  64.     #pragma options align=reset
  65. #endif
  66.  
  67.  
  68. // The structure of our simplified, editable version of the 'cfrg'
  69. struct internalItem {
  70.     OSType     archType;
  71.     long     updateLevel;
  72.     long    currVersion;
  73.     long    oldDefVersion;
  74.     long    appStackSize;
  75.     short    appSubFolder;
  76.     short    usage;
  77.     short    location;
  78.     long    codeOffset;
  79.     long    codeLength;
  80.     Str255    name;
  81. };
  82. typedef struct internalItem internalItem;
  83.  
  84. struct internalResource {
  85.     long             version;
  86.     long             itemCount;
  87.     internalItem    itemList[1];
  88. };
  89. typedef struct internalResource internalResource, *irPtr, **irHand;
  90.  
  91. /* ===== Prototypes ===== */
  92. OSErr Parse_cfrg (Handle theResource, irHand internalCopy);
  93. OSErr Build_cfrg (irHand internalCopy, Handle theResource);
  94.  
  95.  
  96. #endif /* __CFRG__ */
  97.